package com.lyl.utils;

import com.lyl.DTO.MenuDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.EnableMBeanExport;

import java.util.ArrayList;

public class MenuUtils {
    private static MenuDTO OnlineExam = new MenuDTO("OnlineExam","在线考试","el-icon-s-promotion","","",null);
    private static MenuDTO Exam = new MenuDTO("Exam","进入考试","el-icon-time","/onlineExam/Exam","onlineExam/Exam",null);
    private static MenuDTO Score = new MenuDTO("Score","我的成绩","el-icon-trophy","/onlineExam/Score","onlineExam/Score",null);

    private static MenuDTO ExamAdmin = new MenuDTO("ExamAdmin","考试管理","el-icon-help","","",null);
    private static MenuDTO EATestBank = new MenuDTO("EATestBank","题库管理","el-icon-document-copy","/examAdmin/TestBank","examAdmin/TestBank",null);
    private static MenuDTO EATpList = new MenuDTO("EATpList","试卷管理","el-icon-rank","/examAdmin/TpList","examAdmin/TpList",null);
    private static MenuDTO EAScore = new MenuDTO("EAScore","成绩统计","el-icon-orange","/examAdmin/ScoreAdmin","examAdmin/ScoreAdmin",null);

    private static MenuDTO UserManager = new MenuDTO("UserManager","用户管理","el-icon-user","","",null);
    private static MenuDTO Teacher = new MenuDTO("Teacher","教师管理","el-icon-s-promotion","/userManager/Teacher","userManager/Teacher",null);
    private static MenuDTO Student = new MenuDTO("Student","学生管理","el-icon-s-promotion","/userManager/Student","userManager/Student",null);

    private static MenuDTO SysMange = new MenuDTO("SysMange","系统管理","el-icon-setting","","",null);
    private static MenuDTO SysRole = new MenuDTO("SysRole","角色管理","el-icon-s-custom","/sys/Roles","sys/Role",null);
    private static MenuDTO SysSubject = new MenuDTO("SysSubject","专业管理","el-icon-magic-stick","/sys/Subject","sys/Subject",null);
    //共享目录
    public static void CommonMenu(){
        ArrayList<MenuDTO> list1 = new ArrayList<>();
        list1.add(Exam);
        list1.add(Score);
        OnlineExam.setChildren(list1);

        ArrayList<MenuDTO> list2 = new ArrayList<>();
        list2.add(EATestBank);
        list2.add(EATpList);
        list2.add(EAScore);
        ExamAdmin.setChildren(list2);

        ArrayList<MenuDTO> list3 = new ArrayList<>();
        list3.add(SysRole);
        list3.add(SysSubject);
        SysMange.setChildren(list3);

        ArrayList<MenuDTO> list4 = new ArrayList<>();
        list4.add(Teacher);
        list4.add(Student);
        UserManager.setChildren(list4);
    }
    //管理员目录
    public static ArrayList<MenuDTO> AdminMenu(){
        ArrayList<MenuDTO> list = new ArrayList<>();
        list.add(OnlineExam);
        list.add(ExamAdmin);
        list.add(UserManager);
        list.add(SysMange);
        return list;
    }
    //教师目录
    public static ArrayList<MenuDTO> TeacherMenu(){
        ArrayList<MenuDTO> list = new ArrayList<>();
        if (UserManager.getChildren()!=null){
            UserManager.getChildren().remove(0);
        }
        if (SysMange.getChildren()!=null){
            SysMange.getChildren().remove(0);
        }
        ExamAdmin.getChildren().get(0).setTitle("我的题库");
        ExamAdmin.getChildren().get(1).setTitle("我的试卷");
        list.add(ExamAdmin);
        list.add(UserManager);
        list.add(SysMange);
        return list;
    }
    //学生目录
    public static ArrayList<MenuDTO> StudentMenu(){
        ArrayList<MenuDTO> list = new ArrayList<>();
        list.add(OnlineExam);
        return list;
    }
}
